package dao

import (
	"errors"
	"gin_wuwen_back/model"
	"gin_wuwen_back/tool"
)

type PadDao struct {
	*tool.Orm
}

func NewPadDao() *PadDao {
	return &PadDao{tool.Dbengin}

}
func (tmp *PadDao) PaddingUsername(username string) (err error) {
	member := new(model.Member)
	ok, err := tmp.Where("user_name=?",username).Get(member)
	if err != nil {
		return err
	}
	if ok {
		err = errors.New("用户已存在")
		return err
	}

	return nil
}
